package com.zysc.processflow.controller;


import com.zysc.processflow.entity.Handleprocesscc;
import com.zysc.processflow.service.IHandleprocessccService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.zysc.processflow.common.base.BaseController;

/**
 * <p>
 * 处置流程抄送表 前端控制器
 * </p>
 *
 * @author 正元智慧城市_
 * @since 2022-11-18
 */
@Api(value = "处置流程抄送", tags = "处置流程抄送")
@RestController
@RequestMapping("/handleprocesscc")
public class HandleprocessccController extends BaseController<Handleprocesscc> {

    @Autowired
    IHandleprocessccService service;

    public HandleprocessccController(IHandleprocessccService service) {
        super(service);
    }

    /*暂时用不到这些方法 因为这些和handleprocess是绑定在一块的
    @ApiOperation("获取处置流程抄送表列表(支持分页)")
    @PostMapping(value = "GetHandleprocessccList")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "pageIndex", name = "pageIndex", dataType = "String"),
            @ApiImplicitParam(value = "pageSize", name = "pageSize", dataType = "String"),
            @ApiImplicitParam(value = "抄送人姓名", name = "ccername", dataType = "String")
    })
    public ResultBody GetHandleprocessccList(@RequestBody Map<String, Object> params) {
        Integer pageIndex = (Integer) params.get("pageIndex");
        Integer pageSize = (Integer) params.get("pageSize");
        if (pageIndex != null && pageSize != null) {
            IPage<Handleprocesscc> page = new Page<>(pageIndex, pageSize);
            List<Handleprocesscc> res = service.GetHandleprocessccListByPage(page, params);
            return ResultBody.Success(res, page.getTotal());
        } else {
            List<Handleprocesscc> res = service.GetHandleprocessccListByPage(null, params);
            return ResultBody.Success(res);
        }
    }

    @ApiOperation("添加/更新处置流程抄送实体")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "处置流程抄送实体", name = "entity", dataType = "Handleprocesscc")
    })
    @Transactional
    @PostMapping(value = "SaveOrUpdate")
    public ResultBody SaveOrUpdate(@RequestBody Handleprocesscc entity) {
        Boolean b = service.saveOrUpdate(entity);
        if(b){
            return ResultBody.Success(entity);
        }else {
            return ResultBody.error("添加/更新数据失败", 500);
        }
    }

    @ApiOperation("删除处置流程抄送表记录")
    @PostMapping("DeleteHandleprocesscc")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "处置流程抄送表记录id", name = "id", dataType = "String")
    })
    public ResultBody DeleteHandleprocesscc(String id) {
        if (id != null) {
            return ResultBody.Success(service.removeById(id));
        }
        return ResultBody.error("参数不能为空", 400);
    }*/

}
